/* 1791. 找出星型图的中心节点 */
/**
 * @param {number[][]} edges
 * @return {number}
 */
var findCenter = function (edges) {
    const map = new Map()
    for (const edge of edges) {
        const [v1, v2] = edge
        map.set(v1, map.get(v1) ? map.get(v1) + 1 : 1)
        map.set(v2, map.get(v2) ? map.get(v2) + 1 : 1)
    }

    for (const [value, count] of map) {
        if (count > 1) return value
    }
};


var findCenter = function (edges) {
    return edges[0][0] === edges[1][0] || edges[0][0] === edges[1][1] ? edges[0][0] : edges[0][1]
}
const res = findCenter([[1, 2], [2, 3], [4, 2]])
console.log(res);